import request from '@/config/axios'

// 用户资源兑换 VO
export interface UserAssetsCodeVO {
  id: number // 主键id
  userId: number // 用户id
  changeId: number // 套餐id
  code: string // 兑换码
  customerName: string // 客户名称
  status: number // 状态
  expireDate: Date // 过期时间
  customerId: number // 客户id
  usedDate: Date // 使用日期
}

// 用户资源兑换 API
export const UserAssetsCodeApi = {
  // 查询用户资源兑换分页
  getUserAssetsCodePage: async (params: any) => {
    return await request.get({ url: `/system/ai/user-assets-code/page`, params })
  },

  // 查询用户资源兑换详情
  getUserAssetsCode: async (id: number) => {
    return await request.get({ url: `/system/ai/user-assets-code/get?id=` + id })
  },

  // 新增用户资源兑换
  createUserAssetsCode: async (data: UserAssetsCodeVO) => {
    return await request.post({ url: `/system/ai/user-assets-code/create`, data })
  },

  // 修改用户资源兑换
  updateUserAssetsCode: async (data: UserAssetsCodeVO) => {
    return await request.put({ url: `/system/ai/user-assets-code/update`, data })
  },

  // 删除用户资源兑换
  deleteUserAssetsCode: async (id: number) => {
    return await request.delete({ url: `/system/ai/user-assets-code/delete?id=` + id })
  },

  // 导出用户资源兑换 Excel
  exportUserAssetsCode: async (params) => {
    return await request.download({ url: `/system/ai/user-assets-code/export-excel`, params })
  },
}
